package com.spdb.oa.parser;

import java.util.HashMap;
import java.util.Map;

import javax.xml.parsers.ParserConfigurationException;

import com.spdb.oa.type.OAServiceFunction;
import com.spdb.oa.type.Version;
import com.spdb.oa.util.OAConstants;

public class OAXMLParserFactory {
	final static private Map<String, ParserStrategy> strategyMap = new HashMap<String, ParserStrategy>();
	static {
		try {
			strategyMap.put(OAServiceFunction.GetSubmit.toString() + Version.OneDotZero.toString(), new GetSubmitParserStrategy());
			strategyMap.put(OAServiceFunction.GetSubmit.toString() + Version.OneDotOne.toString(), new GetSubmitWithoutUserParserStrategy());
		} catch (ParserConfigurationException e) {
			e.printStackTrace();
		}
		
	}
	
	public static ParserStrategy getParserStrategy(String functionName, Version version ) {
		return strategyMap.get(functionName + version.toString());
	}
	
	
}
